﻿/*
' DotNetNuke® - http://www.dotnetnuke.com
' Copyright (c) 2002-2006
' by Perpetual Motion Interactive Systems Inc. ( http://www.perpetualmotion.ca )
'
' Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated 
' documentation files (the "Software"), to deal in the Software without restriction, including without limitation 
' the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and 
' to permit persons to whom the Software is furnished to do so, subject to the following conditions:
'
' The above copyright notice and this permission notice shall be included in all copies or substantial portions 
' of the Software.
'
' THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED 
' TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 
' THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF 
' CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 
' DEALINGS IN THE SOFTWARE.
 */

using System;
using DotNetNuke;
using System.Data;

using DotNetNuke.Framework;

namespace Triax.Modules.Department
{
    /// -----------------------------------------------------------------------------
    /// <summary>
    /// An abstract class that provides the DAL contract
    /// </summary>
    /// <remarks>
    /// </remarks>
    /// <history>
    /// </history>
    /// -----------------------------------------------------------------------------
    public abstract class DataProvider
    {

    #region Shared/Static Methods

        // singleton reference to the instantiated object 
        static DataProvider  objProvider = null;

        // constructor
        static DataProvider()
        {
            CreateProvider();
        }

        // dynamically create provider
        private static void CreateProvider()
        {
            objProvider = (DataProvider)Reflection.CreateObject("data", "Triax.Modules.Department", "");
        }

        // return the provider
        public static  DataProvider Instance() 
        {
            return objProvider;
        }

    #endregion

    #region Abstract methods

        // Department
        public abstract void AddDepartment(int ModuleId, string DepartmentName, string Description, int ParentId, int DepartmentType, int Status, int UserId,  int DepartmentUserId);
        public abstract IDataReader GetDepartment(int ModuleId, int DepartmentId);
        public abstract IDataReader GetDepartments(int ModuleId);
        public abstract void UpdateDepartment(int ModuleId, int DepartmentId, string DepartmentName, string Description, int ParentId, int DepartmentType, int Status, int UserId,  int DepartmentUserId);
        public abstract void DeleteDepartment(int ModuleId, int DepartmentId);
        public abstract IDataReader GetDepartmentsByParent(int ModuleId);
        public abstract IDataReader GetAllDepartmentsByParent(int ModuleId);
        public abstract IDataReader GetDepartmentsByCond(int ModuleId, string Cond, string Sql);

        // DepartmentSubject
        public abstract void AddDepartmentSubject(int ModuleId, int DepartmentId, int SubjectId, int Status, int UserId);
        public abstract IDataReader GetDepartmentSubject(int ModuleId, int DepartmentSubjectId);
        public abstract IDataReader GetDepartmentSubjects(int ModuleId);
        public abstract void UpdateDepartmentSubject(int ModuleId, int DepartmentSubjectId, int DepartmentId, int SubjectId, int Status, int UserId);
        public abstract void DeleteDepartmentSubject(int ModuleId, int DepartmentSubjectId);
        public abstract IDataReader GetDepartmentSubjectsByCond(int ModuleId, string Cond, string Sql);
        public abstract void DeleteDepartmentSubjectByCond(int ModuleId, string Cond, string Sql);

        // ĐƠn vị tập đoàn
        public abstract void AddDonViTapDoan(int ModuleId,

                                               string code,
                                               string title,
                                               int ParentId,
                                               string Description,
                                               double temp_double1,
                                               double temp_double2,
                                               string temp_string1,
                                               string temp_string2,
                                               string temp_string3,
                                               int temp_int1,
                                               int temp_int2,
                                               int temp_int3,
                                               int CreatedByUser,
                                               DateTime CreatedDate,
                                               int UpdatedByUser,
                                               DateTime UpdatedDate
           );
        public abstract IDataReader GetDonViTapDoan(int ModuleId, int ItemId);
        public abstract IDataReader GetDonViTapDoans(int ModuleId);
        public abstract IDataReader GetDonViTapDoansByCond(int ModuleId, string cond, string sql);
        public abstract void UpdateDonViTapDoan(int ModuleId,
                                                    int id,
                                                    string code,
                                                    string title,
                                                    int ParentId,
                                                    string Description,
                                                    double temp_double1,
                                                    double temp_double2,
                                                    string temp_string1,
                                                    string temp_string2,
                                                    string temp_string3,
                                                    int temp_int1,
                                                    int temp_int2,
                                                    int temp_int3,
                                                    int CreatedByUser,
                                                    DateTime CreatedDate,
                                                    int UpdatedByUser,
                                                    DateTime UpdatedDate

            );
        public abstract void DeleteDonViTapDoan(int ModuleId, int ItemId);
        // End ĐƠn vị tập đoàn

        // Loại hình đơn vị
        public abstract void AddLoaiHinhDonVi(int ModuleId,

                                                string code,
                                                string title,
                                                int ParentId,
                                                string Description,
                                                double temp_double1,
                                                double temp_double2,
                                                string temp_string1,
                                                string temp_string2,
                                                string temp_string3,
                                                int temp_int1,
                                                int temp_int2,
                                                int temp_int3,
                                                int CreatedByUser,
                                                DateTime CreatedDate,
                                                int UpdatedByUser,
                                                DateTime UpdatedDate
            );
        public abstract IDataReader GetLoaiHinhDonVi(int ModuleId, int ItemId);
        public abstract IDataReader GetLoaiHinhDonVis(int ModuleId);
        public abstract IDataReader GetLoaiHinhDonVisByCond(int ModuleId, string cond, string sql);
        public abstract void UpdateLoaiHinhDonVi(int ModuleId,
                                                    int id,
                                                    string code,
                                                    string title,
                                                    int ParentId,
                                                    string Description,
                                                    double temp_double1,
                                                    double temp_double2,
                                                    string temp_string1,
                                                    string temp_string2,
                                                    string temp_string3,
                                                    int temp_int1,
                                                    int temp_int2,
                                                    int temp_int3,
                                                    int CreatedByUser,
                                                    DateTime CreatedDate,
                                                    int UpdatedByUser,
                                                    DateTime UpdatedDate

            );
        public abstract void DeleteLoaiHinhDonVi(int ModuleId, int ItemId);
        // End Loại hình đơn vị

        // NHóm vụ việc
        public abstract void AddNhomVuViec(int ModuleId,

                                                string code,
                                                string title,
                                                int ParentId,
                                                string Description,
                                                double temp_double1,
                                                double temp_double2,
                                                string temp_string1,
                                                string temp_string2,
                                                string temp_string3,
                                                int temp_int1,
                                                int temp_int2,
                                                int temp_int3,
                                                int CreatedByUser,
                                                DateTime CreatedDate,
                                                int UpdatedByUser,
                                                DateTime UpdatedDate
            );
        public abstract IDataReader GetNhomVuViec(int ModuleId, int ItemId);
        public abstract IDataReader GetNhomVuViecs(int ModuleId);
        public abstract IDataReader GetNhomVuViecsByCond(int ModuleId, string cond, string sql);
        public abstract void UpdateNhomVuViec(int ModuleId,
                                                    int id,
                                                    string code,
                                                    string title,
                                                    int ParentId,
                                                    string Description,
                                                    double temp_double1,
                                                    double temp_double2,
                                                    string temp_string1,
                                                    string temp_string2,
                                                    string temp_string3,
                                                    int temp_int1,
                                                    int temp_int2,
                                                    int temp_int3,
                                                    int CreatedByUser,
                                                    DateTime CreatedDate,
                                                    int UpdatedByUser,
                                                    DateTime UpdatedDate

            );
        public abstract void DeleteNhomVuViec(int ModuleId, int ItemId);
        // End NHóm vụ việc
        // loại vụ việc
        public abstract void AddLoaiVuViec(int ModuleId,

                                                string code,
                                                string title,
                                                int ParentId,
                                                string Description,
                                                double temp_double1,
                                                double temp_double2,
                                                string temp_string1,
                                                string temp_string2,
                                                string temp_string3,
                                                int temp_int1,
                                                int temp_int2,
                                                int temp_int3,
                                                int CreatedByUser,
                                                DateTime CreatedDate,
                                                int UpdatedByUser,
                                                DateTime UpdatedDate
            );
        public abstract IDataReader GetLoaiVuViec(int ModuleId, int ItemId);
        public abstract IDataReader GetLoaiVuViecs(int ModuleId);
        public abstract IDataReader GetLoaiVuViecsByCond(int ModuleId, string cond, string sql);
        public abstract void UpdateLoaiVuViec(int ModuleId,
                                                    int id,
                                                    string code,
                                                    string title,
                                                    int ParentId,
                                                    string Description,
                                                    double temp_double1,
                                                    double temp_double2,
                                                    string temp_string1,
                                                    string temp_string2,
                                                    string temp_string3,
                                                    int temp_int1,
                                                    int temp_int2,
                                                    int temp_int3,
                                                    int CreatedByUser,
                                                    DateTime CreatedDate,
                                                    int UpdatedByUser,
                                                    DateTime UpdatedDate

            );
        public abstract void DeleteLoaiVuViec(int ModuleId, int ItemId);
        // End loại vụ việc

        // Xử lý vụ việc
        public abstract void AddXuLyVuViec(int ModuleId,

                                                string code,
                                                string title,
                                                DateTime Thoigian,
                                                int ParentId,
                                                string Description,
                                                double temp_double1,
                                                double temp_double2,
                                                string temp_string1,
                                                string temp_string2,
                                                string temp_string3,
                                                int temp_int1,
                                                int temp_int2,
                                                int temp_int3,
                                                int CreatedByUser,
                                                DateTime CreatedDate,
                                                int UpdatedByUser,
                                                DateTime UpdatedDate
            );
        public abstract IDataReader GetXuLyVuViec(int ModuleId, int ItemId);
        public abstract IDataReader GetXuLyVuViecs(int ModuleId);
        public abstract IDataReader GetXuLyVuViecsByCond(int ModuleId, string cond, string sql);
        public abstract void UpdateXuLyVuViec(int ModuleId,
                                                    int id,
                                                    string code,
                                                    string title,
                                                    DateTime Thoigian,
                                                    int ParentId,
                                                    string Description,
                                                    double temp_double1,
                                                    double temp_double2,
                                                    string temp_string1,
                                                    string temp_string2,
                                                    string temp_string3,
                                                    int temp_int1,
                                                    int temp_int2,
                                                    int temp_int3,
                                                    int CreatedByUser,
                                                    DateTime CreatedDate,
                                                    int UpdatedByUser,
                                                    DateTime UpdatedDate

            );
        public abstract void DeleteXuLyVuViec(int ModuleId, int ItemId);
        // End Xử lý vụ việc

        // Vụ việc
        public abstract void AddVuViec(int ModuleId,

                                               int Quy,
int Nam,
int Tuan,
int Stt,
int loaivuviec,
int tenCN,
int tongCT,
DateTime ngayBaoCao,
string tomTatNoiDung,
int Chet_SQ,
int chet_QNCN,
int chet_CNVQP,
int chet_HDLD,
int chet_CTV,
int chet_Dan,
int biThuong_SQ,
int biThuong_QNCN,
int biThuong_CNVQP,
int biThuong_HDLD,
int biThuong_HDDV,
int biThuong_CTV,
int biThuong_CTV_Khac,
int biThuong_Dan,
double taiChinh,
int taiSan_otoViettel,
int taiSan_otoDanSu,
int taiSan_Moto,
string taiSan_Khac,
string thietHai_hangHoa,
int thietHai_MangLuoi_BTS,
int thietHai_MangLuoi_Phido,
int thietHai_MangLuoi_Acqui,
int thietHai_MangLuoi_TiepDia,
double thietHai_MangLuoi_Cap,
double TongThietHai,
int NguyenNhan_chuQuan,
int NguyenNhan_khacQuan,
int loi_quanNhan_SQ,
int loi_quanNhan_QNCN,
int loi_quanNhan_CSVQP,
int loi_quanNhan_HDLD,
int loi_quanNhan_CTV,
int loi_dan,
int DangVien,
int DoanVien,
string TInhCHat,
int baocao_TapDoan,
int baocao_CucDTHS,
int baocao_TUxuLy,
double KQ_Xulybandau,
string KQ_Tien,
string KQ_HinhThucKyLuat,
int KQ_Tamgiam,
int KQ_HinhPhat,
string CanBoTheodoi,
string otherText1,
string otherText2,
string otherText3,
string otherText4,
string otherText5,
string otherText6,
string otherText7,
string otherText8,
int otherInt1,
int otherInt2,
int otherInt3,
int otherInt4,
int otherInt5,
int otherInt6,
double otherInt7,
double otherInt8,
DateTime otherDatetime1,
DateTime otherDatetime2,
DateTime otherDatetime3,
DateTime otherDatetime4,
DateTime otherDatetime5,
DateTime otherDatetime6,
DateTime otherDatetime7,
DateTime otherDatetime8,

                                               int CreatedByUser,
                                               DateTime CreatedDate,
                                               int UpdatedByUser,
                                               DateTime UpdatedDate
           );
        public abstract IDataReader GetVuViec(int ModuleId, int ItemId);
        public abstract IDataReader GetVuViecs(int ModuleId);
        public abstract IDataReader GetVuViecsByCond(int ModuleId, string cond, string sql);
        public abstract void UpdateVuViec(int ModuleId,
                                                    int id,
                                                   int Quy,
int Nam,
int Tuan,
int Stt,
int loaivuviec,
int tenCN,
int tongCT,
DateTime ngayBaoCao,
string tomTatNoiDung,
int Chet_SQ,
int chet_QNCN,
int chet_CNVQP,
int chet_HDLD,
int chet_CTV,
int chet_Dan,
int biThuong_SQ,
int biThuong_QNCN,
int biThuong_CNVQP,
int biThuong_HDLD,
int biThuong_HDDV,
int biThuong_CTV,
int biThuong_CTV_Khac,
int biThuong_Dan,
double taiChinh,
int taiSan_otoViettel,
int taiSan_otoDanSu,
int taiSan_Moto,
string taiSan_Khac,
string thietHai_hangHoa,
int thietHai_MangLuoi_BTS,
int thietHai_MangLuoi_Phido,
int thietHai_MangLuoi_Acqui,
int thietHai_MangLuoi_TiepDia,
double thietHai_MangLuoi_Cap,
double TongThietHai,
int NguyenNhan_chuQuan,
int NguyenNhan_khacQuan,
int loi_quanNhan_SQ,
int loi_quanNhan_QNCN,
int loi_quanNhan_CSVQP,
int loi_quanNhan_HDLD,
int loi_quanNhan_CTV,
int loi_dan,
int DangVien,
int DoanVien,
string TInhCHat,
int baocao_TapDoan,
int baocao_CucDTHS,
int baocao_TUxuLy,
double KQ_Xulybandau,
string KQ_Tien,
string KQ_HinhThucKyLuat,
int KQ_Tamgiam,
int KQ_HinhPhat,
string CanBoTheodoi,
string otherText1,
string otherText2,
string otherText3,
string otherText4,
string otherText5,
string otherText6,
string otherText7,
string otherText8,
int otherInt1,
int otherInt2,
int otherInt3,
int otherInt4,
int otherInt5,
int otherInt6,
double otherInt7,
double otherInt8,
DateTime otherDatetime1,
DateTime otherDatetime2,
DateTime otherDatetime3,
DateTime otherDatetime4,
DateTime otherDatetime5,
DateTime otherDatetime6,
DateTime otherDatetime7,
DateTime otherDatetime8,

                                                    int CreatedByUser,
                                                    DateTime CreatedDate,
                                                    int UpdatedByUser,
                                                    DateTime UpdatedDate

            );
        public abstract void DeleteVuViec(int ModuleId, int ItemId);
        // End Vụ việc
        // Két hợp xử lý
        public abstract void AddKetHopXuLy(int ModuleId,

                                                string code,
                                                string title,
                                                DateTime Thoigian,
                                                int ParentId,
                                                string Description,
                                                double temp_double1,
                                                double temp_double2,
                                                string temp_string1,
                                                string temp_string2,
                                                string temp_string3,
                                                int temp_int1,
                                                int temp_int2,
                                                int temp_int3,
                                                int CreatedByUser,
                                                DateTime CreatedDate,
                                                int UpdatedByUser,
                                                DateTime UpdatedDate
            );
        public abstract IDataReader GetKetHopXuLy(int ModuleId, int ItemId);
        public abstract IDataReader GetKetHopXuLys(int ModuleId);
        public abstract IDataReader GetKetHopXuLysByCond(int ModuleId, string cond, string sql);
        public abstract void UpdateKetHopXuLy(int ModuleId,
                                                    int id,
                                                    string code,
                                                    string title,
                                                    DateTime Thoigian,
                                                    int ParentId,
                                                    string Description,
                                                    double temp_double1,
                                                    double temp_double2,
                                                    string temp_string1,
                                                    string temp_string2,
                                                    string temp_string3,
                                                    int temp_int1,
                                                    int temp_int2,
                                                    int temp_int3,
                                                    int CreatedByUser,
                                                    DateTime CreatedDate,
                                                    int UpdatedByUser,
                                                    DateTime UpdatedDate

            );
        public abstract void DeleteKetHopXuLy(int ModuleId, int ItemId);
        // End Kết hợp xử lý

    #endregion
    
    }
}
